﻿@model ConsentViewModel
@{
    ViewData["Title"] = "index";
}

<h2>认证授权中心</h2>
<div class="page-consent">
    <div class="row page-header">
        <div class="col-sm-10">
            @if (!string.IsNullOrWhiteSpace(Model.ClientLogo))
            {
                <div><img src="@Model.ClientLogo"></div>
            }
            <h1>
                @Model.ClientName
                <small>需要使用你的账户</small>
            </h1>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-8">
            <form asp-action="Index" class="consent-form">
                <input type="hidden" asp-for="ReturnUrl" />
                <div>请选择你要授权的内容？</div>
                @if (Model.IdentityScopes.Any())
                {
                    <div class="panel panel-default consent-buttons">
                        <div class="panel-heading">
                            <span class="glyphicon glyphicon-user"></span>
                            个人信息
                        </div>
                        <ul class="list-group">
                            @foreach (var scope in Model.IdentityScopes)
                            {
                                @Html.Partial("_ScopeListItem", scope)
                            }
                        </ul>
                    </div>
                }
                @if (Model.ResourceScopes.Any())
                {
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <span class="glyphicon glyphicon-tasks"></span>
                            应用授权
                        </div>
                        <ul class="list-group">
                            @foreach (var scope in Model.ResourceScopes)
                            {
                                @Html.Partial("_ScopeListItem", scope)
                            }
                        </ul>
                    </div>
                }

                @if (Model.AllowRememberConsent)
                {
                    <div class="consent-remember">
                        <label>
                            <input class="consent-scopecheck" asp-for="RememberConsent" />
                            <strong>记住我的授权，下次不用再询问？</strong>
                        </label>
                    </div>
                }
                <div class="consent-buttons">
                    <button name="button" value="yes" class="btn btn-primary" autofocus>同意</button>
                    <button name="button" value="no" class="btn">拒绝</button>
                    @if (!string.IsNullOrWhiteSpace(Model.ClientUrl))
                    {
                        <a class="pull-right btn btn-default" target="_blank" href="@Model.ClientUrl">
                            <span class="glyphicon glyphicon-info-sign"></span>
                            <strong>@Model.ClientName</strong>
                        </a>
                    }
                </div>
            </form>
        </div>
    </div>
</div>